package cn.hbu.zlfw.admin.dao.impl;


import java.util.Map;
import java.lang.StringBuffer;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import cn.hbu.zlfw.admin.dao.RootAdminDao;
import cn.hbu.zlfw.admin.entity.RootAdmin;
import cn.hbu.zlfw.common.base.dao.impl.BaseDaoImpl;
import cn.hbu.zlfw.common.util.Utility;

/**
 * 
 * @ClassName: RootAdminDaoImpl 
 * @Description: 总管理员dao接口实现
 * @author 王鹏伟<1223443289@qq.com>
 * @date 2017年11月28日 下午9:27:39 
 * @vsersion:v1.0
 */
@Repository("rootAdminDao")
public class RootAdminDaoImpl extends BaseDaoImpl<RootAdmin, String> implements RootAdminDao{
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.admin.dao.RootAdminDao#getRootAdminByParam(java.lang.String, java.lang.String)
	 */
	@Override
	public RootAdmin getRootAdminByParam(Map<String,Object> params) {
		StringBuffer sbf = new StringBuffer();
		sbf.append("from RootAdmin where ");
		for (Map.Entry<String, Object> param : params.entrySet()) {
			sbf.append(param.getKey()+"=:"+param.getKey()+" and ");
		}
		sbf.append(" delState=:delState ");
		params.put("delState", 0);
		Query query=this.getSession().createQuery(sbf.toString());
		return (RootAdmin) Utility.queryParameterUtil(query, params).uniqueResult();
	}

}
